/**
 * DateFormatUtil.java
 * com.opsys.api.vsop.util
 *
 * Function：(一句话功能说明) 
 *
 *  version      date      		  author
 * ──────────────────────────────────────
 *  Ver 1.0  2013-11-8    CWL
 *
 * Copyright(c) 2013, PUKKA All Rights Reserved.
*/

package com.zhehekeji.opsys.api.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * (一句话功能说明)
 *
 * @author   CWL
 * @version  1.0
 * @see
 * @since    1.0
 * @Date	2013-11-8   下午5:03:05
 */
public final class DateFormatUtil {
	
	public static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";
	
	public static final String format(Date date, String pattern){
		if (date == null){
			return null;
		}
		if (pattern == null){
			pattern = DEFAULT_PATTERN;
		}
		SimpleDateFormat format = new SimpleDateFormat(pattern);
		return format.format(date);
	}
	
	public static final String format(Date date){
		return format(date, null);
	}
}

